//
//  YYUMengProtocol.swift
//  YYProject
//
//  Created by 陆文宇 on 2017/8/29.
//  Copyright © 2017年 陆文宇. All rights reserved.
//

import Foundation
import Kingfisher

protocol YYUmengProtocol {
        
}

extension YYUmengProtocol {
    
    func yy_share(title: String, des: String, thumbImage: String, url: String) {
        if let image = UIImage(named: thumbImage) {
            YYUMeng.shareAction(title: title, des: des, thumbImage: image, url: url)
        } else {
            SVProgressHUD.showStatus("加载中...")
            KingfisherManager.shared.retrieveImage(with: URL(string: thumbImage)!, options: nil, progressBlock: nil, completionHandler: { (image, error, _, _) in
                SVProgressHUD.dismiss()
                
                if let image = image {
                    YYUMeng.shareAction(title: title, des: des, thumbImage: image, url: url)
                }
            })
        }
    }
    
}

